		 <script type="text/javascript" src="newMessageAjax.js"></script>
		 <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
		  <script type="text/javascript" src="jquery.dNotify.js"></script>
		  <link rel="stylesheet" type="text/css" href="./dNotify.css" media="screen" />
		 

<script type="text/javascript">

		$.dNotify('good', "Welcome to dNotify test page! :)", {duration: 3000});
		
		
</script>




	@Override
	public int getMessagesCountFromUser(String userName)
	{
		String findMessagesQuery = ""
				+ "SELECT COUNT(rm.messageRead) FROM  ReceivedMessages AS rm "
				+ "WHERE rm.recipient = :userName AND rm.messageRead=true";

		Query query = this.manager.createQuery(findMessagesQuery);
		query.setParameter("userName", userName);
		Long lResult = (Long)(query.getSingleResult());
		
		long l = lResult;
		int res = (int)l;
		
		return res;

	}
	